Options Results;clr=3;if getclip('st_init')~==1 then exit;parse arg scargs':'prefix' 'type' 'channel' :'text;parse var prefix nick'!'user'@'host;if substr(user,1,1)=='~' then;do;user=substr(user,2);prefix=nick'!'user'@'host;end;if scargs~=='' then type=scargs;"GETMYNICK";mynick=result;type=lower(type);signal value type;exit;lower:;return translate(arg(1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ');CTCP:;flp=getclip('sc_floodp');if flp=='ON' then if fcheck(host) then ignore_flood();div='01'x;clr=5;parse upper var text (div) command args (div);x=getclip('sc_extrctcp');if x~=='' then;do forever;z=find(x,command);if z==0 then leave;amrx('CTCP/'word(getclip('sc_extrscr'),z) ':'prefix' PRIVMSG 'channel' :'text);y=wordindex(x,z);parse var x=y . x;end;if command=='' then exit;if command=='VERSION' then;do;ctcpreply(nick,getclip('st_version'));exit;end;if command=='SOURCE' then;do;ctcpreply(nick,'http://www.mentasm.com/~zed/ariel.html');exit;end;if command=='XDCC' then signal xdcc;if getclip('sc_ctcpauto')~=='ON' then exit;if find('HELP INVITE UNBAN PAGE IDENT KICK WHOIS',command)==0 then exit;parse var args channel nk;"CHANNELS";chans=upper(result);Select;when command='PAGE' then;do;x=getclip('sc_page');if x=''|x='OFF' then exit;if x='FRIENDS'&~checklist(prefix,'') then exit;ctcpreply(nick,'Paging...');"SHOW";setclip('st_iconified');cecho('Page',bld(nick) 'has paged you');"PLAYSOUND Page.WAV";if getclip('sc_log')=='ON' then;do;text='PAGE';addawaylog();end;end;when command='IDENT' then;do;pr='CTCPIdent';if getclip('sc_ctcpident')~=='ON' then;do;cecho(pr,'CTCP Ident is disabled');sht();end;x=upper(getclip('sc_password'));Select;when args~=x|x='' then;do;cecho(pr,'Wrong password from' nick ':' x);sht();end;when checklist(prefix,'') then;do;cecho(pr,'User' nick 'already recognised');ctcpreply(nick,'I recognise you there');end;when checklist('*!'user'@*','') then;do;cecho(pr,'Authentication sucessfull from' nick);amrx('kuang11c ADDH' nick);end;otherwise;cecho(pr,'Rejected attempt from' nick);sht();end;end;when command='HELP' then;do;if ~checklist(prefix,'') then sht();setclip('st_rsys',nick);amrx('kuang11c showu' pxn);end;when ~checklist(prefix,'c') then sht();when command='WHOIS' then signal dowhois;when args='' then ctcpreply(nick,'Specify channel');when find(chans,channel)=0 then ctcpreply(nick,'I am not on' channel);when ~chanpass() then ctcpreply(nick,channel 'not enabled');when ~isop(mynick) then ctcpreply(nick,'I am not op on' channel);when command='UNBAN' then;do;if pos('O',pxf)=0 then sht();if nk='' then;do;ctcpreply(nick,'Specify hostmask');exit;end;mod('-b' nk);cecho('CTCPUnban',nick 'removed ban' nk 'from' channel);ctcpreply(nick,'Removed ban' bld(nk) 'from' bld(channel));end;when command='INVITE' then if pos('I',pxf)~=0 then 'RAW INVITE' nick channel;else sht();when command='KICK' then;do;if pos('O',pxf)=0 then sht();Select;when nk='' then ctcpreply(nick,'Specify nick');when nk=mynick|checklist(nk,'p') then;do;cecho('CTCPKick',nick 'tried to kick protected user' nk 'on' channel);ctcpreply(nick,nk 'is protected');end;otherwise;cecho('CTCPKick',nick 'kicked' nk 'on' channel);kck(nk,'Requested');end;end;end;otherwise;end;exit;fcheck:;do while getclip('st_f')~=='';delay(10);end;setclip('st_f',1);f=arg(1);ln='st_last'type;cn='st_count'type;l=getclip(ln);t=time('s');if l='' then;do;setclip(cn,1);setclip(ln,f t);setclip('st_f');return 0;end;p=pos(' ',l);d=t-substr(l,p+1);if f==substr(l,1,p-1)&d<getclip('sc_resetcount') then;do;ct=getclip(cn)+1;if ct==getclip('sc_sensor'type) then;do;setclip(cn);setclip(ln);setclip('st_f');return 1;end;setclip(cn,ct);setclip(ln,f t);setclip('st_f');return 0;end;setclip(cn);setclip(ln);setclip('st_f');return 0;ignore_flood:;amrx('handleflood :'prefix type channel);exit;dccmsg:;if getclip('sc_dcclog')=='ON' then if getclip('sc_log')=='ON' then addawaylog();exit;privmsg:;clr=2;if getclip('sc_floodp')=='ON' then if length(text)>150 then if fcheck(host) then ignore_flood();if upper(substr(text,1,4))=='XDCC' then;do;type='ctcp';parse upper var text command args;signal xdcc;end;if getclip('st_vote')~=='' then if length(text)<3 then if pos(upper(text),'BKS')~==0 then;do;amrx('Kuang11cmd VOTETST' nick text);exit;end;if getclip('sc_log')=='ON' then addawaylog();exit;notice:;if getclip('sc_floodp')=='ON' then if length(text)>150 then if fcheck(host) then ignore_flood();exit;MODE:;if nick==mynick then exit;parse var channel channel fl nx;if ~chanpass()|~isop(mynick) then exit;if pos('!',prefix)==0 then;do;if getclip('sc_nhp')=='ON' then nhpp='ON';nhp='ON';vy=0;fprot=getclip('sc_fprot');autop=getclip('sc_autop');sban=getclip('sc_sban');end;else;do;vy=checklist(prefix,'v');if vy==0 then;do;prot=getclip('sc_prot');fprot=getclip('sc_fprot');autop=getclip('sc_autop');sban=getclip('sc_sban');revenge=getclip('sc_rvg');if revenge=='NONP' then if ~checklist(prefix,'p') then revenge='ON';x=getclip('sc_deop');if x=='ON'|x=='FRIENDS' then;do;if x=='FRIENDS' then if ~checklist(prefix,'o') then break;x=getclip('sc_deopc');if x~=='ALL' then if pos(upper(channel),x)==0 then break;dopnf='ON';end;end;end;o='+';nc=0;mf='';mn='';clr=4;do c=1 to length(fl);ec=substr(fl,c,1);Select;when ec=='-'|ec=='+' then o=ec;when ec=='v' then nc=nc+1;when ec=='b'|ec=='o' then;do;nc=nc+1;m=o||ec;if prot=='ON' then if fcheck(host||channel||m) then mdact();tnick=word(nx,nc);select;when m=='-b' then if vy==0 then if checklist(tnick,'b') then;do;cecho('AutoBan',tnick 'on' channel);notic(nick,bld(pxh) 'is perm banned here.');end;when m=='+b' then;do;Select;when checkipmask(mynick||'!'||gethost(mynick),tnick) then;do;if getclip('sc_saveban')=='ON' then;do;mod('-bo+b' tnick nick '*!@'host);kck(nick,'DONT ban me motherfucker!');end;else mod('-b' tnick);if nhp=='ON' then cecho('NetHack','Ban on you on' channel 'from' prefix);else cecho('SaveBan',nick 'banned you on' channel);end;when fprot=='ON' then if checklist(tnick,'p') then;do;mf=mf'-b';mn=mn tnick;if revenge=='ON' then rvgkick();pxn=lower(pxn);if nhp=='ON' then cecho('NetHack','Ban on' tnick '('pxn') on' channel 'from' prefix);else cecho('Protect',nick 'banned' tnick '('pxn') on' channel);end;when prot=='ON'&sban=='ON' then if pos('?',tnick)~==0 then;do;mf=mf'-b';mn=mn tnick;if revenge=='ON' then kck(nick,'Screw YOU!');if nhp=='ON' then cecho('NetHack','ScrewBan' tnick 'on' channel 'from' prefix);else cecho('ScrewBan',nick 'banned' tnick 'on' channel);end;otherwise;end;end;when m=='+o' then;do;Select;when nhpp=='ON'|dopnf=='ON' then if ~checklist(tnick,'o') then;do;mf=mf'-o';mn=mn tnick;cecho('NetHack',tnick 'on' channel);end;when vy==0 then if checklist(tnick,'d') then;do;mf=mf'-o';mn=mn tnick;cecho('AutoDeop',tnick 'on' channel);end;otherwise;end;end;when m=='-o'&autop=='ON'&fprot=='ON'&tnick~==nick then if checklist(tnick,'op') then;do;mf=mf'+o';mn=mn tnick;if revenge=='ON' then rvgkick();cecho('Protect',nick 'deoped' tnick 'on' channel);end;otherwise;end;end;otherwise;end;end;if mf~=='' then;do;sn='';tf='';do i=1 to length(mf) by 2;s=substr(mf,i,1);f=substr(mf,i+1,1);if s~==sn then;do;tf=tf||s;sn=s;end;tf=tf||f;end;mod(tf mn);end;exit;gethost:;"USERHOST" arg(1);return result;chanpass:;achan=getclip('sc_autochannels');if achan=='ALL' then return 1;if find(achan,upper(channel))~==0 then return 1;return 0;isop:;if find(getusers(channel),'@'arg(1))~==0 then return 1;return 0;getusers:PROCEDURE;"GETUSERS CHANNEL" arg(1);return result;checklist:PROCEDURE EXPOSE mynick pxf pxn pxc pxh flist getl;if getl~=='1' then;do;getl=1;pxc='';flist=upper(getclip('st_list'));end;if flist=='-' then return 0;c=upper(arg(1));f=upper(arg(2));if pos('!',c)==0 then c=c'!'gethost(c);if c==pxc then if verify(f,pxf)==0 then return 1;else return 0;l=flist;do until l='';parse var l hs nk fl l;if verify(f,fl)==0 then;do;hp=hs;do until hs='';parse var hs ht '+' hs;if checkipmask(c,'*!'ht) then;do;pxh='*!'ht;pxc=c;pxf=fl;pxn=nk;return 1;end;end;end;end;return 0;checkipmask:PROCEDURE;i1=arg(1);i2=arg(2);if pos('*',i1)==0 then;do;"MATCHUSERHOST" i1 i2;return rc;end;parse var i1 n1'!'u1'@'h1;parse var i2 n2'!'u2'@'h2;if u1=='*'&h1=='*' then if n1==n2 then return 1;else return 0;if ~ptm(u1,u2) then return 0;if ~ptm(h1,h2) then return 0;if ~ptm(n1,n2) then return 0;return 1;ptm:PROCEDURE;i1='-'arg(1)'-';i2='-'arg(2)'-';if i1='-*-'|i2='-*-' then return 1;if pos('*',i1)~==0&length(i1)<=length(i2) then;do;t=i1;i1=i2;i2=t;end;p=0;do until i2='';parse var i2 c '*' i2;p=pos(c,i1,p+1);if p==0 then return 0;end;return 1;join:;if nick==mynick then exit;channel=substr(channel,2);if ~chanpass()|~isop(mynick) then exit;clr=3;myhost=gethost(mynick);myhost=substr(myhost,pos('@',myhost)+1);if getclip('sc_prot')=='ON'&getclip('sc_mjoin')=='ON'&host~==myhost then if fcheck(channel||host) then;do;if checklist(prefix,'v') then exit;us=getusers(channel);c=0;nx='';mod('+nb *!*@'host);do i=1 to words(us);nk=strip(word(us,i),'L','@+');chost=gethost(nk);chost=substr(chost,pos('@',chost)+1);if chost=host then;do;c=c+1;nx=nx nk;kck(nk,'CloneBots');end;end;cecho('MassJoin',c 'clones joining' channel ':'nx);exit;end;if getclip('sc_autop')=='ON' then if checklist(prefix,'o') then;do;x=getclip('sc_autopdel');if x~==''&x~=='0' then;do;if getclip('sc_randel')=='ON' then x=random(1,x,time('s'));delay(x*50);if isop(nick) then exit;end;mod('+o' nick);cecho('AutoOp',nick 'on' channel);exit;end;if checklist(prefix,'b') then;do;mod('+b' lower(pxh));kck(nick,'Banned');cecho('AutoBan',nick 'on' channel);exit;end;if checklist(prefix,'e') then;do;mod('+v' nick);cecho('AutoVoice',nick 'on' channel);end;exit;kick:;if nick==mynick then exit;if getclip('sc_fprot')~=='ON' then exit;parse var channel channel nk .;if ~chanpass()|~isop(mynick)|nk==nick then exit;if checklist(prefix,'v') then exit;clr=4;if getclip('sc_prot')=='ON'&getclip('sc_mkick')=='ON' then if fcheck(host||channel) then;do;mdact();exit;end;rvg=getclip('sc_rvg');if rvg=='NONP' then;do;if checklist(prefix,'p') then exit;rvg='ON';end;if rvg=='ON' then if checklist(nk,'p') then;do;rvgkick();cecho('Protect',nick 'kicked' nk 'on' channel);end;exit;hilite:;clr=1;if getclip('sc_asound')=='ON' then if upper(left(text,length(mynick)+1))=='!'upper(mynick)&words(text)>1 then;do;f=word(text,2);if f==compress(f,'/:`"*') then;do;"GETCTCPSOUNDDIR";df=prsprg(result)||f;pr='SoundSend';if exists(df) then 'SAY /DCC SEND' nick df;end;compr=1;end;c=getclip('sc_comprefix');If c~=='' then if substr(text,1,length(c))==c then;do;if checklist(prefix,'') then pxfn=pxf;else pxfn='-';parse upper var text (c) command t .;if t='' then pxf='-';else if ~checklist(t,'') then pxf='-';x=getclip('sc_pubcmd');if x~=='' then;do forever;z=find(x,command);if z==0 then leave;amrx('pub/'word(getclip('sc_pubscr'),z) nick channel pxfn pxf isop(mynick) chanpass() substr(text,2));y=wordindex(x,z);parse var x=y . x;end;compr=1;end;if getclip('sc_shit')=='ON' then;do;t=upper(text);s=getclip('sc_swords');do until s='';parse var s w s;if pos(w,t)~=0 then;do;if ~chanpass()|~isop(mynick) then exit;if checklist(prefix,'v') then exit;if getclip('sc_bankickwords')=='ON' then;do;x=getclip('st_lastword');parse var x n t .;if x==''|n~=nick then t=0;t=t+1;m=getclip('sc_maxword');if m='' then m=3;if t=m then;do;mod('+b *!*@'host);t=0;end;else if t=m-1 then notic(nick,'The next time you say' w 'will be ban time!');setclip('st_lastword',nick t);end;kck(nick,'WordKick');cecho('WordKick',nick 'said' w);compr=1;end;end;end;x=getclip('st_skick');if x~=='' then if upper(nick)==x then;do;if ~isop(mynick) then exit;t=getclip('st_skickt');if t='' then t=0;t=t+1;if t=4 then;do;mod('+b *!*@'host);t='';end;else if t=3 then notic(nick,"Final warning!I'll ban you next time!");kck(nick,'I told you _NOT_ to speak!');setclip('st_skickt',t);compr=1;end;if getclip('sc_hlog')=='ON'&compr~='1' then;do;text=text'(HILITE)';addawaylog();end;exit;dcc:;if fcheck(host) then ignore_flood();div=x2c('01');a=getclip('sc_autoget');parse var text (div) . c f dat (div);upper c f;clr=5;Select;when c='RESUME'|c='ACCEPT' then;do;parse upper var dat p s .;if f='YOU'&p='ALREADY'&s='HAVE' then exit;if~datatype(p,'n') then ignore_flood();if p<1024 then ignore_flood();if f~=compress(f,'/:`"*') then ignore_flood();if ~datatype(s,'n') then ignore_flood();if s<0 then ignore_flood();end;when c='CHAT' then;do;parse var dat i p .;if f~=='CHAT' then ignore_flood();if datatype(i,'n')=0|((length(i)~=10)&(length(i)~=9)) then ignore_flood();if~datatype(p,'n') then ignore_flood();if p<1024 then ignore_flood();"GETAWAYSTATE";if rc==5 then;do;if getclip('sc_log')~=='ON' then exit;text='DCCCHAT';addawaylog();end;Select;when a='ON'|a='FRIENDS' then if ~checklist(prefix,'a') then exit;when a='ALLFRIENDS' then if ~checklist(prefix,'') then exit;when a~='ALL' then exit;otherwise;end;'SAY /DCC CHAT' nick;cecho('AutoGet','Accepting chat from' nick);ply('AUTOGET');end;when c='TSEND'|c='SEND'|c='MOVE' then;do;parse var dat i p s .;if (datatype(i,'n')=0)|((length(i)~=10)&(length(i)~=9)) then ignore_flood();if~datatype(p,'n') then ignore_flood();if p<1024 then ignore_flood();if c='MOVE' then f=substr(f,2,length(f)-2);if f~=compress(f,'/:`"*') then ignore_flood();if s<0 then ignore_flood();pr='AutoGet';uf=upper(f);x=getclip('st_autoget');Select;when find(x,uf)~=0 then;do;xn='';do until x='';parse var x cf x;if cf~=uf then xn=xn cf;end;setclip('st_autoget',strip(xn));end;when a='ON'|a='FRIENDS' then if ~checklist(prefix,'a') then exit;when a='ALLFRIENDS' then if ~checklist(prefix,'') then exit;when a~='ALL' then exit;otherwise;end;"GETDCC";if dcc.receive.0>0 then;do i=1 to dcc.receive.0;parse value dcc.receive.i WITH mnick moveflag hostname state len cps mfilename;mfilename=substr(mfilename,max(pos(':',mfilename),pos('/',mfilename))+1);if upper(mfilename)=uf&(state=1|state=2) then;do;cecho(pr,'Already receiving' mfilename 'from' mnick);exit;end;end;"GETDCCRECEIVEDIR";cf=prsprg(result)||f;com='GET';if exists(cf) then;do;l=word(statef(cf),2);if l=s then;do;cecho(pr,'File already exists and is same size!');exit;end;if c='SEND'&l<s then com='RESUME';end;'SAY /dcc' com nick f;cecho(pr,'Accepting' f 'from' nick);ply('AUTOGET');end;otherwise;end;exit;invite:;if getclip('sc_floodp')=='ON' then;do;if fcheck(host) then ignore_flood();fld=' in 15 seconds.';end;else fld='';x=getclip('sc_autojoin');if x==''|x=='OFF' then exit;if x=='FRIENDS' then if ~checklist(prefix,'i') then exit;cecho('AutoJoin','Joining' text||fld);if fld~=='' then;do;delay(750);if getclip('st_lastig')=host then exit;end;'RAW JOIN' text;exit;xdcc:;if left(channel,1)~=='#' then channel=getchan();else if getclip('sc_xdcc_masskick')=='ON' then;do;if isop(mynick) then;do;if getclip('sc_xdcc_massban')=='ON' then mod('+b *!*@'host);kck(nick,'Mass XDCC LIST');end;cecho('MassXDCC',nick 'on' channel);exit;end;if getclip('sc_xdcc')~=='ON' then;do;notic(nick,'XDCC is disabled.');exit;end;sec=getclip('sc_xdccsec');psec=1;if sec=='OPS' then psec=isop(nick);else if sec=='PACKS'|sec=='ALL' then psec=checklist(prefix,'x');parse upper var args c s .;if c='' then c='HELP';if c~=='LIST'&s~='' then s=s isop(mynick);amrx('KUANG11XDCC' psec type c nick s);exit;bld:PROCEDURE;b='02'x;return B||arg(1)||b;und:PROCEDURE;u='1F'x;return u||arg(1)||u;inv:PROCEDURE;i='16'x;return i||arg(1)||i;cecho:;"ECHO P="d2c(27)"b«"arg(1)"» C="clr arg(2);return 0;vecho:;"ECHO P="d2c(27)"b«Kuang11» C="clr und(arg(1)||':') arg(2)'.';return 0;notic:;'RAW NOTICE' arg(1) ':'arg(2);return 0;rvgkick:;if getclip('sc_rvgd')=='ON' then mod('-o' nick);if getclip('sc_rvgb')=='ON' then mod('+b *!*@'host);if getclip('sc_rvgk')=='ON' then;do;kmsg=getclip('sc_pkickmsg');p=pos('%N',upper(msg));if p~=0 then kmsg=insert(pxn,delstr(kmsg,p,2),p-1);kck(nick,kmsg);end;return 0;ply:;if getclip('sc_playsounds')~=='ON' then return 0;'PLAYSOUND _K11'arg(1)'.snd';return 0;kck:;'RAW KICK' channel arg(1) ':'arg(2);return 0;mod:;'RAW MODE' channel arg(1);return 0;getchan:;"GETCHANNEL";return result;ctcpreply:;'RAW NOTICE' arg(1) ':'div||command arg(2)div;return 0;sht:;ctcpreply(nick,'Access denied');exit;amrx:;'SAY /RX' arg(1);return 0;prsprg:PROCEDURE;x=arg(1);z=right(x,1);if z~='/'&z~=':' then x=x||'/';if upper(left(x,8))='PROGDIR:' then;do;y=pragma('d');z=right(y,1);if z~='/'&z~=':' then y=y||'/';if length(x)>8 then return y||substr(x,9);else return y;end;return x;addawaylog:;"GETAWAYSTATE";if rc~==5 then exit;fn='Kuang11/AwayLog';if exists(fn) then s='A';else s='W';open(1,fn,s);writeln(1,nick time() text);close(1);x=getclip('st_awaymsgs');if x=='' then x=0;setclip('st_awaymsgs',x+1);if getclip('sc_aicon')=='ON'&getclip('st_iconified')=='' then;do;setclip('st_iconified',1);"HIDE";end;if type=='hilite' then exit;stime=getclip('st_awayt');if stime='' then;do;stime=date('I') Time('S');setclip('st_awayt',stime);end;parse var stime sdate stime .;total=trunc((time('s')+date('i')*86400-stime-sdate*86400)/60);hrs=trunc(total/60);mns=total-hrs*60;if hrs=0 then hrs='';else if hrs=1 then hrs='1 hour,';else hrs=hrs 'hours,';str=hrs||mns 'minutes';notic(nick,"I've been away for "str'. Your message has been logged.');exit;mdeop:;pr='NFDeop';channel=getchan();md='';nxt=getusers(channel);cecho(pr,'Checking ops on' channel);do until nxt='';parse var nxt nk nxt;nko=strip(nk,'L','@+');if left(nk,1)='@'&nko~==mynick&~checklist(nko,'o') then md='o'md nko;end;if md~='' then;do;mod('-'md);cecho(pr,'Executed on' channel);end;else cecho(pr,'Noone to deop');exit;mdact:;mass='';Select;when type=='kick' then mass='Kick';When m=='-o' then if getclip('sc_mdeop')=='ON' then mass='Deop';When m=='+o' then if getclip('sc_mop')=='ON' then mass='Op';When m=='-b' then if getclip('sc_muban')=='ON' then mass='UnBan';Otherwise;if getclip('sc_mban')=='ON' then mass='Ban';end;if mass~=='' then;do;cecho('Mass'mass,bld(nick) 'on' bld(channel));kck(nick,'Mass'mass 'detected.Go sit in a corner');prot='';mass='';end;return 0;whois:;args=prefix;dowhois:;pxf='';pr='CheckUser';if pos('!',args)=0 then if pos('@',args)~=0 then prefix='*!'args;else prefix=args'!'gethost(args);Select;when args='' then;do;if type='ctcp' then ctcpreply(nick,'Specify user/hostmask');else cecho(pr,'Specify user/hostmask');exit;end;when checklist(prefix,'') then args='showu' pxn;otherwise;l=bld(args) ': unknown nick/hostmask.';if type='ctcp' then ctcpreply(nick,l);else cecho(pr,l);exit;end;if type='ctcp' then setclip('st_rsys',nick);amrx('kuang11c' args)